GroupBox

1import { Button, GroupBox, Label, Navigation, NavigationStack, Script, ScrollView, Text, Toggle, useState, VStack } from "scripting"
2
3function Example() {
4  const dismiss = Navigation.useDismiss()
5  const [userAgreed, setUserAgreed] = useState(false)
6  const agreementText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
7
8  return <NavigationStack>
9    <VStack
10      navigationTitle={"GroupBox"}
11      navigationBarTitleDisplayMode={"inline"}
12      toolbar={{
13        cancellationAction: <Button
14          title={"Done"}
15          action={dismiss}
16        />
17      }}
18    >
19      <GroupBox
20        label={
21          <Label
22            title={"End-User Agreement"}
23            systemImage={"building.columns"}
24          />
25        }
26      >
27        <ScrollView
28          frame={{
29            height: 100,
30          }}
31        >
32          <Text>{agreementText}</Text>
33        </ScrollView>
34        <Toggle
35          value={userAgreed}
36          onChanged={setUserAgreed}
37        >
38          <Text>I agree to the above terms</Text>
39        </Toggle>
40      </GroupBox>
41    </VStack>
42  </NavigationStack>
43}
44
45async function run() {
46  await Navigation.present({
47    element: <Example />
48  })
49
50  Script.exit()
51}
52
53run()